package com.zhang.passer.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhang.passer.domain.CommentDao;
import com.zhang.passer.mapper.CommentMapper;
import com.zhang.passer.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("comment")
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<CommentDao> queryAllByBid(int bid,String btype) {
        QueryWrapper<CommentDao> queryWrapper = new QueryWrapper<>(new CommentDao().setBid(bid).setBtype(btype));
        return commentMapper.selectList(queryWrapper);
    }

    @Override
    public Integer addComment(CommentDao commentDao) {
        return commentMapper.insert(commentDao);
    }
}
